package com.sqy.controller;

import com.sqy.entity.Likes;
import com.sqy.exception.ImoocMallExceptionEnum;
import com.sqy.service.LikeService;
import com.sqy.utlis.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Like")
@Api(tags = "猜你喜欢板块")
public class LikeController {


    @Autowired
    LikeService likeService;

    @PostMapping("/add")
    @ApiOperation("添加猜你喜欢图标")
    public ApiResult addLike(@RequestBody Likes likes){

        boolean save = likeService.save(likes);

        if(save){
            return  ApiResult.success();
        }
        return  ApiResult.error(ImoocMallExceptionEnum.ADD_FAIL);
    }

}
